import { defineStore } from 'pinia'


//? 1、定义容器
const loginUserStore = defineStore('user', {
    state: () => {
        return {
            userinfo: {}
        }
    },
    getters: {},// 类似于组件的computed,用来封装计算属性，有缓存的功能
    actions: {
        addToken() {
            let tododata = JSON.parse(String(localStorage.getItem("userinfo")))
            this.userinfo = tododata
        }
    }// 类似与组件的 methods ,封装业务逻辑，修改 state
})

export { loginUserStore }